package com.cskaoyan.day03.linked;

/**
 * @author stone
 * @date 2022/01/29 19:36
 */
public class ListDemo {
    public static void main(String[] args) {
        MyArrayList<String> list = new MyArrayList<>();
        //list.add(null);//node.value=null
        list.add("红");
        list.add("橙");
        list.add("黄");
        System.out.println(list.size());
        //null-->红-->橙-->黄-->
        list.show();
        list.remove(null);
        //红-->橙-->黄-->
        list.show();
        list.remove("黄");
        //红-->橙-->
        list.show();

        list.add(0, "黑");
        list.add(2, "白");
        //黑-->红-->白-->橙-->
        list.show();

        System.out.println(list.remove(2));
        list.show();
        list.set(1, "心想事橙");
        System.out.println(list.get(1));

        System.out.println(list.contains("橙"));
        System.out.println(list.contains("白"));

        list.show();
        list.set("橙", "happynewyear");
        list.show();
    }
}
